#ifndef QAPPWIDGET_H
#define QAPPWIDGET_H

#include <QObject>
#include <QString>
#include <QFile>
#include <QLabel>

#include "filebased.h"
#include "projectslistmodel.h"
#include "pfileitem.h"
#include "pdomparser.h"
#include "pkmlparser.h"

class QAppWidget : public QObject
{
Q_OBJECT

public:

    QAppWidget( void );

    enum ERR_stateValidator{
        err_ok,
        err_generic,
        err_no_convertible,
        err_intermediate,
        err_invalid_input,
        err_unknown
                };

    enum ERR_stateLineEdit{
        le_err_ok,
        le_err
                };

    static void errMsgBox(
            const QString& message_text,
            const QString& informative_text = "",
            const QString& detailed_text = ""
            );

    static void errMsgBox(ExaFileErr file_err, const QString& informative_text = "");

    static void errMsgBox(ExaModuleErr err, const QString& informative_text = "");
    static void errMsgBox(ExaModuleErr err, const PFileItem &item);

    static void errMsgBox(ProjectsListModel::PrjBuildErr err);

    static void errMsgBox(PDomParser::PDomParserErr err, const QString &informative_text = "");
    static void errMsgBox(PKmlParser::PKmlParserErr err, const QString &informative_text = "");

    static bool fileDlgOpen(
                  QWidget* parent,
            const QString& file_description,
            const QString& file_ext,
                  QString& file_name
            );
    static bool fileDlgOpen(
                  QWidget* parent,
            const FileBased& file,
                  QString& file_name
            );
    static bool fileDlgSave(
                  QWidget* parent,
            const QString& file_description,
            const QString& file_ext,
                  QString& file_name
            );
    static bool fileDlgSave(
                  QWidget* parent,
            const FileBased& file,
                  QString& file_name
            );
    static bool validatorDouble
            (
                      int  min,
                      int  max,
                      int  precision,
            const QString& text_to_validate,
                   double& value,
       ERR_stateValidator* err    = 0,
                      bool msgbox = false,
            const QString& value_name = ""
            );

    static bool validatorInt
            (
                      int  min,
                      int  max,
            const QString& text_to_validate,
                      int& value,
       ERR_stateValidator* err    = 0,
                      bool msgbox = false,
            const QString& value_name = ""
            );

    static void lineEditErr(ERR_stateLineEdit err,
                     QLabel* label_up_lineEdit,
                     const QString& msg = ""
            );

    static QString DLG_STYLE_SHEET;

    static bool removeDir(const QString &dirName);
};

#endif // QAPPWIDGET_H
